#!/usr/bin/node
const log = console.log,
      Dog = require('./05-dog.js');
//实例化
let taidi = new Dog('taidi',4),
    zangao = new Dog('zangao',8);

taidi.on('bark',onBark.bind(taidi));
zangao.on('bark',onBark.bind(zangao));
function onBark(){
  log(`${this.name()} barked! energy:${this.energy()}`);
}
